package com.pys.menu;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.pys.menu.MenuChildItem;

public class MenuParentItem implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = 1L;
	private String title;
	private String type;
	private String link;
	private String img;
	private String openAsPopUp;
	private String popUpWidth;
	private String popUpHeight;
	private String display = "none";
	private String styleClass = "";
	private List<MenuChildItem> childList;

	public MenuParentItem() {
		this.childList = new ArrayList<MenuChildItem>();
	}

	public void addChildItem(MenuChildItem childItem) {
		this.childList.add(childItem);
	}

	public void show() {
		setDisplay("block");
		setStyleClass("selectedSub");
		if (getImg().indexOf("-") != -1)
			setImg(getImg().substring(0, getImg().indexOf("-")) + "-on.gif");
	}

	public MenuParentItem(String title, String type, String link, String img,
			List<MenuChildItem> childList) {
		super();
		this.title = title;
		this.type = type;
		this.link = link;
		this.img = img;
		this.childList = childList;
	}

	public void hide() {
		setDisplay("none");
		setStyleClass("");
		if (getImg().indexOf("-") != -1)
			setImg(getImg().substring(0, getImg().indexOf("-")) + "-off.gif");
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public List<MenuChildItem> getChildList() {
		return childList;
	}

	public void setChildList(List<MenuChildItem> childList) {
		this.childList = childList;
	}

	public String getLink() {
		return link;
	}

	public void setLink(String link) {
		this.link = link;
	}

	public String getImg() {
		return img;
	}

	public void setImg(String img) {
		this.img = img;
	}

	public String getDisplay() {
		return display;
	}

	public void setDisplay(String display) {
		this.display = display;
	}

	public String getStyleClass() {
		return styleClass;
	}

	public void setStyleClass(String styleClass) {
		this.styleClass = styleClass;
	}

	public String getOpenAsPopUp() {
		return openAsPopUp;
	}

	public void setOpenAsPopUp(String openAsPopUp) {
		this.openAsPopUp = openAsPopUp;
	}

	public String getPopUpWidth() {
		return popUpWidth;
	}

	public void setPopUpWidth(String popUpWidth) {
		this.popUpWidth = popUpWidth;
	}

	public String getPopUpHeight() {
		return popUpHeight;
	}

	public void setPopUpHeight(String popUpHeight) {
		this.popUpHeight = popUpHeight;
	}
}
